import MgrAudio from "./MgrAudio";

const { ccclass, property } = cc._decorator;

@ccclass
export default class TopHandler extends cc.Component {

    _isFirstTouch: boolean = true;

    onLoad() {
        this.node.on(cc.Node.EventType.TOUCH_START, this.onTouchStart, this);
        this.node["_touchListener"].swallowTouches = false;
    }

    start() {

    }

    onTouchStart(event: cc.Event.EventTouch) {
        if (this._isFirstTouch) {
            this._isFirstTouch = false;
            MgrAudio.Instance.PlayBGMusic();
        }
        MgrAudio.Instance.PlayMusic(0);
    }

}